<!-- 库房管理 -->
<template>
    <div class="common-layout">
    <el-container>
      <el-header>
        <el-form-item label="库房">
      <el-input placeholder="请输入库房名称" style="width: 200px" />&emsp;
      <el-button type="primary" @click="queryWarehouse">查询</el-button>
    </el-form-item>
    <el-button type="primary" @click="addWarehouse">添加</el-button>
      </el-header>
      <el-main style="height: 300px;">
        <div class="warehouse-management">
      <el-table :data="warehouseList" style="width: 100%;">
        <el-table-column prop="warehouseId" label="序号" />
        <el-table-column prop="warehouseName" label="库房名称" width="150px" />
        <el-table-column prop="warehouseAddress" label="库房地址" />
        <el-table-column prop="dict_Item" label="库房编码" />
        <el-table-column prop="warehouseStatus" label="状态" />
        <!-- <el-table-column prop="contactPerson" label="联系人" width="150"></el-table-column>
        <el-table-column prop="contactPhone" label="联系电话" width="150"></el-table-column> -->
        <el-table-column prop="warehouseCapacity" label="库房面积" />
        <!-- <el-table-column prop="creationTime" label="创建时间" width="200"></el-table-column> -->
        <el-table-column label="操作" width="160px">
            <template v-slot="">
                <el-link >编辑</el-link>&emsp;
                <el-link >查看</el-link>&emsp;
                <el-link >删除</el-link>
            </template>
        </el-table-column>
      </el-table>
    </div>
      </el-main>
      <el-footer>
        <el-pagination style="margin-top: 10px;" v-model:current-page="paging.pageIndex" v-model:page-size="paging.pageSize"
        :page-sizes="[1, 2, 3]" :background="true" layout="total, sizes, prev, pager, next, jumper"
        :total="paging.recordCount" />
      </el-footer>
    </el-container>
  </div>
    
    
  </template>
  
  <script lang="ts" setup>
  import { ref, reactive, onMounted, watch } from "vue"
  import { ElMessage } from "element-plus"
  import { useRouter } from "vue-router"
  import { useCounterStore } from "@/stores/counter"
  import axios from "axios"
  
  const store = useCounterStore()
  const router = useRouter()
  
  const paging = reactive({
      pageIndex: 1,
      pageSize: 10,
      recordCount: 1,
      pageCount: 1
  })
  
  watch(paging, () => {
      getPendings()
  })
  
  //钩子
  onMounted(() => {
      getPendings()
  })
  //查询按钮
  const queryWarehouse = () => {
      getPendings()
  }
  
  //添加按钮
  const addWarehouse = () => {
      //router.push({ name: "addWarehouse" })
  }
  
  const warehouseList = ref<any>([])
  const getPendings = () => {
      axios.get("http://localhost:5129/api/BasicData/GetWareHouseList")
      .then(res => {
        console.log(res)
        warehouseList.value = res.data.data
          //  paging.recordCount = res.data.data.totalCount
          //  paging.pageCount = res.data.data.totalPage
      })
  }
  
  </script>
  
  <style scoped>
  .warehouse-management {
    margin: 20px;
  }
  
</style>